﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tracy.DataModel;
using Tracy;

namespace TracyGUI.UIComponent
{
    class ListBoxItemEntry
    {
        Entry _data;
        int _unWatchedCount = 0;

        public int UnWatchedCount
        {
            get { return _unWatchedCount; }
        }

        public Entry Data
        {
            get { return _data; }
            set {
                _data = value;
                if (_data != null)
                {
                    _unWatchedCount = TracyFacade.Instance.MediaFileProvider.GetUnwatchedCount(_data);
                }
                else
                {
                    _unWatchedCount = 0;
                }
            }
        }
        public ListBoxItemEntry(Entry data )
        {
            Data = data;
        }

        public override string ToString()
        {
            if (Data == null) return "";
            else
            {
                if (_unWatchedCount > 0)
                    return String.Format("{0} ({1})", Data.Name, _unWatchedCount);
                else
                    return Data.Name;
            }
        }

    }
}
